﻿#pragma once

class CORE_API Direction
{
public:
  static const uint8_t Left = 0;  // x-
  static const uint8_t Right = 1; // x+
  static const uint8_t Up = 2;    // y+
  static const uint8_t Down = 3;  // y-
  static const uint8_t Front = 4; // z+
  static const uint8_t Back = 5;  // z-

  static const uint8_t South = Front;
  static const uint8_t North = Back;
  static const uint8_t West = Left;
  static const uint8_t East = Right;

  static const uint8_t PositiveX = Front;
  static const uint8_t NegtiveX = Back;
  static const uint8_t PositiveY = Up;
  static const uint8_t NegtiveY = Down;
  static const uint8_t PositiveZ = Right;
  static const uint8_t NegtiveZ = Left;

  static const uint8_t None = 6;

  Direction(uint8_t dir = Direction::North) : m_dir(dir) {};

  static Direction MatchDirctionByRotation(glm::vec3 rotaion);
  static Direction MatchDirctionByRotationY(float rotaionY);
  static Direction MatchDirctionByFacingNormal(glm::ivec3 normal);

  Direction GetOppsite() const;
  std::string ToString() const;

  operator uint8_t() const { return m_dir; }

  static glm::vec3 GetDirectionVec(uint8_t dir);

  uint8_t m_dir = None;
};